package cn.justweb;

import java.util.ArrayList;

public class Demo1 {
    public static void main(String[] args) {
        ArrayList<Student> list=new ArrayList<>();
        Student student1=new Student("zs","11");
        Student student2=new Student("ls","12");
        list.add(student1);
        list.add(student2);
        list.add(new Student("ww","13"));
        System.out.println(list);
        System.out.println(list.get(0));
       //集合的下标越界异常
       // System.out.println(list.get(3));
        //size方法获取集合中的元素的数量
        System.out.println("list.size() = " + list.size());
        //根据元素内容删除指定元素。
        //list.remove(student1);
      //  System.out.println(list);
        //根据索引删除元素
        list.remove(1);
        System.out.println("aaa");

        System.out.println("bbb");

    }

}
